﻿#include "callingdll.h"
using namespace std;

CallingDLL::CallingDLL()
{
    TMC7="./tmsdk/tmusb.so";
    TCLC6="./TM_C6/tmusb.so";
// TCLC6="/data/tmsdk/tmusb.so";
 ZJX_S2 = new QLibrary("./ZJX_S2/libMcs8CommonInf.so");
    //QLibrary TM_C7("./tmsdk/tmusb.so"); //加载DLL文件
    //QLibrary TCL_C6("./tmsdk/tmusb.so"); //加载DLL文件
    //QLibrary CL_T6("./tmsdk/tmusb.so"); //加载DLL文件
    //TCL_R1 = new QLibrary("./R1/ZFYINFO.dll"); //加载DLL文件
    //TCL_3A = new QLibrary("./3A/DVDll.dll"); //加载DLL文件
    //TCL_C7 = new QLibrary("./TCL_C7/TCL_C7.dll"); //加载DLL文件
    //TCL = new QLibrary("./MYDES.dll"); //加载DLL文件
    //TCL_S8 =new QLibrary("./tcls8sdk.dll"); //加载DLL文件
    //License = new QLibrary("./license/MYDES.dll"); //加载DLL文件
}
CallingDLL::~CallingDLL() {
//    delete TM_C7;
//    //delete TCL_C6;
//    delete TCL_T6;
//    delete TCL_R1;
//    delete TCL_3A;
//    delete TCL_C7;
//    delete TCL;
//    delete License;
}
//int CallingDLL::TMUsbInit()
//{
//    //将当前工作目录设置为应用程序所在的目录
//    QDir::setCurrent(QCoreApplication::applicationDirPath());
//    typedef int (*newCfun)();
//    newCfun funtest; //用于存放DLL函数的指针
//    if (TCL->load()) {
//        qDebug() << "TMUsbDll加载成功";
//        funtest = (newCfun)TCL->resolve("TM_Usb_Init");
//        if (funtest) {
//            qDebug() << "/TCL/TM_Usb_Init解析成功";
//            //解析成功后，就可以使用funtest()来调用Cfun函数了：
//            // qDebug() << funtest();
//            return funtest();
//        }
//        else
//        {
//            qDebug() << "/TCL/TM_Usb_Init解析失败";
//        }
//    } else {
//        qDebug() << "/TCL/TMUsbDll加载失败: " << TCL->errorString();
//    }
//    return -5;
//}
int CallingDLL::TMC7TMUsbInit()
{
    //QDir::setCurrent(QCoreApplication::applicationDirPath());
      QLibrary TM_C7(TMC7);
    typedef int (*newCfun)();
    newCfun funtest;
    if (TM_C7.load()) {
        qDebug() << "TMUsbDll loaded successfully";
        funtest = (newCfun)TM_C7.resolve("TM_Usb_Init");
        if (funtest) {
            qDebug() << "/TM_C7/TM_Usb_Init resolved successfully";

            int result = funtest();

            return result;

        } else {
            qDebug() << "/TM_C7/TM_Usb_Init resolution failed";
            return FUNCTION_CALL_FAIL;
        }
    } else {
        qDebug() << "/TM_C7/TMUsbDll loading failed: " << TM_C7.errorString();
        return LOAD_FAIL;
    }
    return FEQUEST_FAIL;
}

int CallingDLL::TMC7TMdevices(int* count,pDeviceArray* devices_list)
{

    //将当前工作目录设置为应用程序所在的目录
    //QDir::setCurrent(QCoreApplication::applicationDirPath());
        QLibrary TM_C7(TMC7);
    typedef int (*newCfun)(int* count,pDeviceArray* devices_list);
    newCfun funtest; //用于存放DLL函数的指针
    if (TM_C7.load()) {
        qDebug() << "/TM_C7/TMUsbDll加载成功";

        funtest = (newCfun)TM_C7.resolve("TM_devices");
        if (funtest) {
            qDebug() << "/TM_C7/TM_devices解析成功";

            int result = funtest(count,devices_list);


            return result;
        }
        else
        {
            qDebug() << "/TM_C7/TM_devices解析失败";
            return FUNCTION_CALL_FAIL;

        }
    } else {
        qDebug() << "/TM_C7/TMUsbDll加载失败: " << TM_C7.errorString();
        return LOAD_FAIL;
    }
    return FEQUEST_FAIL;
}
int CallingDLL::TMC7TMconnect(char* const device_name,int* index)//连接指定设备
{

    //将当前工作目录设置为应用程序所在的目录
    qDebug() <<QString::fromUtf8(device_name);
   QLibrary TM_C7(TMC7);
    typedef int (*newCfun)(char* const device_name,int* index);
    newCfun funtest; //用于存放DLL函数的指针
    if (TM_C7.load()) {
        qDebug() << "TMUsbDll加载成功";
        funtest = (newCfun)TM_C7.resolve("TM_connect");
        if (funtest) {
            qDebug() << "/TM_C7/TM_connect解析成功";
            //解析成功后，就可以使用funtest()来调用Cfun函数了：
            //qDebug() << funtest();
            int result =funtest(device_name,index);
            return result;

        }
        else
        {
            qDebug() << "/TM_C7/TM_connect解析失败";
            return FUNCTION_CALL_FAIL;
        }
    } else {
        qDebug() << "/TM_C7/TMUsbDll加载失败: " << TM_C7.errorString();
        return LOAD_FAIL;
    }
    return FEQUEST_FAIL;
}
int CallingDLL::TMC7TMgetpolicenumByIndex(int index,char* police_num)//获取警员编号
{

    //将当前工作目录设置为应用程序所在的目录
    QLibrary TM_C7(TMC7);
    typedef bool (*newCfun)(int index,char* police_num);
    newCfun funtest; //用于存放DLL函数的指针
    //QLibrary *lib = new QLibrary("./TM_C7/TMUsbDll.dll"); //加载DLL文件
    if (TM_C7.load()) {
        qDebug() << "TMUsbDll加载成功";
        funtest = (newCfun)TM_C7.resolve("TM_get_police_num_By_Index");
        if (funtest) {
            qDebug() << "/TM_C7/TM_get_police_num_By_Index解析成功";
            //解析成功后，就可以使用funtest()来调用Cfun函数了：
            return funtest(index,police_num);

        }
        else
        {
            qDebug() << "/TM_C7/TM_get_police_num_By_Index解析失败";
            return FUNCTION_CALL_FAIL;
        }
    } else {
        qDebug() << "/TM_C7/TMUsbDll加载失败: " << TM_C7.errorString();
        return LOAD_FAIL;
    }
    return FEQUEST_FAIL;
}
int CallingDLL::TMC7TMgetbatterylevelByIndex(int index,char* police_num)//获取电量值
{

    //将当前工作目录设置为应用程序所在的目录
   QLibrary TM_C7(TMC7);
    typedef bool (*newCfun)(int index,char* police_num);
    newCfun funtest; //用于存放DLL函数的指针

    if (TM_C7.load()) {
        qDebug() << "TMUsbDll加载成功";
        funtest = (newCfun)TM_C7.resolve("TM_get_battery_level_By_Index");
        if (funtest) {
            qDebug() << "/TM_C7/TM_get_battery_level_By_Index解析成功";
            //解析成功后，就可以使用funtest()来调用Cfun函数了：
            return funtest(index,police_num);
        }
        else
        {
            qDebug() << "/TM_C7/TM_get_battery_level_By_Index解析失败";
            return FUNCTION_CALL_FAIL;
        }
    } else {
        qDebug() << "/TM_C7/TMUsbDll加载失败: " << TM_C7.errorString();
        return LOAD_FAIL;
    }
    return FEQUEST_FAIL;
}
int CallingDLL::TMC7TMSetTime(int index,_SYSTEMTIME dateTime) //校时
{

    //将当前工作目录设置为应用程序所在的目录
   QLibrary TM_C7(TMC7);
    typedef int (*newCfun)(int index,_SYSTEMTIME dateTime);
    newCfun funtest; //用于存放DLL函数的指针
    //QLibrary *lib = new QLibrary("./TM_C7/TMUsbDll.dll"); //加载DLL文件
    if (TM_C7.load()) {
        qDebug() << "TMUsbDll加载成功";
        funtest = (newCfun)TM_C7.resolve("TM_Set_Time");
        if (funtest) {
            qDebug() << "/TM_C7/TM_Set_Time解析成功";
            //解析成功后，就可以使用funtest()来调用Cfun函数了：
            return funtest(index,dateTime);
        }
        else
        {
            qDebug() << "/TM_C7/TM_Set_Time解析失败";
            return FUNCTION_CALL_FAIL;
        }
    } else {
        qDebug() << "/TM_C7/TMUsbDll加载失败: " << TM_C7.errorString();
        return LOAD_FAIL;
    }
    return FEQUEST_FAIL;
}
int CallingDLL::TMC7TMGMGetDeviceSN(int index,char* police_num,int* iRet)//获取电量值
{

    //将当前工作目录设置为应用程序所在的目录
    QLibrary TM_C7(TMC7);
    typedef bool (*newCfun)(int index,char* police_num,int* iRet);
    newCfun funtest; //用于存放DLL函数的指针
    //QLibrary *lib = new QLibrary("./TM_C7/TMUsbDll.dll"); //加载DLL文件
    if (TM_C7.load()) {
        qDebug() << "TMUsbDll加载成功";
        funtest = (newCfun)TM_C7.resolve("TM_GM_GetDeviceSN");
        if (funtest) {
            qDebug() << "/TM_C7/TM_GM_GetDeviceSN解析成功";
            //解析成功后，就可以使用funtest()来调用Cfun函数了：
            return funtest(index,police_num,iRet);
        }
        else
        {
            qDebug() << "/TM_C7/TM_GM_GetDeviceSN解析失败";
            return FUNCTION_CALL_FAIL;
        }
    } else {
        qDebug() << "/TM_C7/TMUsbDll加载失败: " << TM_C7.errorString();
        return LOAD_FAIL;
    }
    return FEQUEST_FAIL;
}
int CallingDLL::TMC7TMEntryUMSByIndex(int index)//执法仪转盘
{

    //将当前工作目录设置为应用程序所在的目录
    QLibrary TM_C7(TMC7);
    typedef bool (*newCfun)(int index);
    newCfun funtest; //用于存放DLL函数的指针
    // QLibrary *lib = new QLibrary("./TM_C7/TMUsbDll.dll"); //加载DLL文件
    if (TM_C7.load()) {
        qDebug() << "TMUsbDll加载成功";
        funtest = (newCfun)TM_C7.resolve("TM_Entry_UMS_By_Index");
        if (funtest) {
            qDebug() << "/TM_C7/TM_Entry_UMS_By_Index解析成功";
            //解析成功后，就可以使用funtest()来调用Cfun函数了：
            return funtest(index);
        }
        else
        {
            qDebug() << "/TM_C7/TM_Entry_UMS_By_Index解析失败";
            return FUNCTION_CALL_FAIL;
        }
    } else {
        qDebug() << "/TM_C7/TMUsbDll加载失败: " << TM_C7.errorString();
        return LOAD_FAIL;
    }
    return FEQUEST_FAIL;
}
int CallingDLL::TMC7TMdisconnectByIndex(int index)//断开设备 或者 拔出USB时调用
{

    //将当前工作目录设置为应用程序所在的目录
    QLibrary TM_C7(TMC7);
    typedef int (*newCfun)(int index);
    newCfun funtest; //用于存放DLL函数的指针
    // QLibrary *lib = new QLibrary("./TM_C7/TMUsbDll.dll"); //加载DLL文件
    if (TM_C7.load()) {
        qDebug() << "DVDll加载成功";
        funtest = (newCfun)TM_C7.resolve("TM_disconnect_By_Index");
        if (funtest) {
            qDebug() << "/TM_C7/TM_disconnect_By_Index解析成功";
            //解析成功后，就可以使用funtest()来调用Cfun函数了：
            return funtest(index);
        }
        else
        {
            qDebug() << "/TM_C7/TM_disconnect_By_Index解析失败";
            return FUNCTION_CALL_FAIL;
        }
    } else {
        qDebug() << "/TM_C7/TMUsbDll加载失败: " << TM_C7.errorString();
        return LOAD_FAIL;
    }
    return FEQUEST_FAIL;
}



int CallingDLL::TCLC6TMUsbInit()
{

   // QDir::setCurrent(QCoreApplication::applicationDirPath());
     QLibrary TCL_C6(TCLC6);
    typedef int (*newCfun)();
    newCfun funtest;
    if (TCL_C6.load()) {
        qDebug() << "TMUsbDll加载成功";
        funtest = (newCfun)TCL_C6.resolve("TM_Usb_Init");
        if (funtest) {
            qDebug() << "/TCL_C6/TM_Usb_Init解析成功";


            int result = funtest();

            return result;
        } else {
            qDebug() << "/TCL_C6/TM_Usb_Init解析失败";
            return FUNCTION_CALL_FAIL;
        }
    } else {
        qDebug() << "/TCL_C6/TMUsbDll加载失败: " << TCL_C6.errorString();
        return LOAD_FAIL;
    }
    return FEQUEST_FAIL;
}

int CallingDLL::TCLC6TMdevices(int* count,pDeviceArray* devices_list)
{
int a=FUNCTION_CALL_FAIL;
    //将当前工作目录设置为应用程序所在的目录
    QDir::setCurrent(QCoreApplication::applicationDirPath());
      QLibrary TCL_C6(TCLC6);
    typedef int (*newCfun)(int* count,pDeviceArray* devices_list);
    newCfun funtest; //用于存放DLL函数的指针
    if (TCL_C6.load()) {
        qDebug() << "/TCL_C6/TMUsbDll加载成功";
        funtest = (newCfun)TCL_C6.resolve("TM_devices");
        if (funtest) {
            qDebug() << "/TCL_C6/TM_devices解析成功";
            a=funtest(count,devices_list);
            return a;
        }
        else
        {
            qDebug() << "/TCL_C6/TM_devices解析失败";
            return FUNCTION_CALL_FAIL;
        }
    } else {
        qDebug() << "/TCL_C6/TMUsbDll加载失败: " << TCL_C6.errorString();
        return LOAD_FAIL;
    }
    return FEQUEST_FAIL;
}
int CallingDLL::TCLC6TMconnect(char* const device_name,int* index)//连接指定设备
{
    int a=FUNCTION_CALL_FAIL;
    //将当前工作目录设置为应用程序所在的目录
      QLibrary TCL_C6(TCLC6);
    qDebug() <<QString::fromUtf8(device_name);
    QDir::setCurrent(QCoreApplication::applicationDirPath());
    typedef int (*newCfun)(char* const device_name,int* index);
    newCfun funtest; //用于存放DLL函数的指针
    if (TCL_C6.load()) {
        qDebug() << "TMUsbDll加载成功";
        funtest = (newCfun)TCL_C6.resolve("TM_connect");
        if (funtest) {
            qDebug() << "/TCL_C6/TM_connect解析成功";
            //解析成功后，就可以使用funtest()来调用Cfun函数了：
            a=funtest(device_name,index);
            return a;
        }
        else
        {
            qDebug() << "/TCL_C6/TM_connect解析失败";
            return FUNCTION_CALL_FAIL;
        }
    } else {
        qDebug() << "/TCL_C6/TMUsbDll加载失败: " << TCL_C6.errorString();
        return LOAD_FAIL;
    }
    return FEQUEST_FAIL;
}
int CallingDLL::TCLC6TMgetpolicenumByIndex(int index,char* police_num)//获取警员编号
{

    //将当前工作目录设置为应用程序所在的目录
      QLibrary TCL_C6(TCLC6);
    QDir::setCurrent(QCoreApplication::applicationDirPath());
    typedef bool (*newCfun)(int index,char* police_num);
    newCfun funtest; //用于存放DLL函数的指针
    if (TCL_C6.load()) {
        qDebug() << "/TCL_C6/TMUsbDll加载成功";
        funtest = (newCfun)TCL_C6.resolve("TM_get_police_num_By_Index");
        if (funtest) {
            qDebug() << "/TCL_C6/TM_get_police_num_By_Index解析成功";
            //解析成功后，就可以使用funtest()来调用Cfun函数了：
            return  funtest(index,police_num);
        }
        else
        {
            qDebug() << "/TCL_C6/TM_get_police_num_By_Index解析失败";
            return FUNCTION_CALL_FAIL;
        }
    } else {
        qDebug() << "/TCL_C6/TMUsbDll加载失败: " << TCL_C6.errorString();
        return LOAD_FAIL;
    }
    return FEQUEST_FAIL;
}
int CallingDLL::TCLC6TMSetTime(int index,_SYSTEMTIME dateTime) //校时
{
    //将当前工作目录设置为应用程序所在的目录
      QLibrary TCL_C6(TCLC6);
    //QDir::setCurrent(QCoreApplication::applicationDirP1ath());
    typedef int (*newCfun)(int index,_SYSTEMTIME dateTime);
    newCfun funtest; //用于存放DLL函数的指针
    if (TCL_C6.load()) {
        qDebug() << "/TCL_C6/TMUsbDll加载成功";
        funtest = (newCfun)TCL_C6.resolve("");
        if (funtest) {
            qDebug() << "/TCL_C6/TM_Set_Time解析成功";
            //解析成功后，就可以使用funtest()来调用Cfun函数了：
            return  funtest(index,dateTime);
        }
        else
        {
            qDebug() << "/TCL_C6/TM_Set_Time解析失败";
            return FUNCTION_CALL_FAIL;
        }
    } else {
        qDebug() << "/TCL_C6/TMUsbDll加载失败: " << TCL_C6.errorString();
        return LOAD_FAIL;
    }
    return FEQUEST_FAIL;
}
int CallingDLL::TCLC6TMgetbatterylevelByIndex(int index,char* police_num)
{

    //将当前工作目录设置为应用程序所在的目录
      QLibrary TCL_C6(TCLC6);
    //QDir::setCurrent(QCoreApplication::applicationDirPath());
    typedef bool (*newCfun)(int index,char* police_num);
    newCfun funtest; //用于存放DLL函数的指针

    if (TCL_C6.load()) {
        qDebug() << "/TCL_C6/TMUsbDll加载成功";
        funtest = (newCfun)TCL_C6.resolve("TM_get_battery_level_By_Index");
        if (funtest) {
            qDebug() << "/TCL_C6/TM_get_battery_level_By_Index解析成功";
            //解析成功后，就可以使用funtest()来调用Cfun函数了：
            return  funtest(index,police_num);
        }
        else
        {
            qDebug() << "/TCL_C6/TM_get_battery_level_By_Index解析失败";
            return FUNCTION_CALL_FAIL;
        }
    } else {
        qDebug() << "/TCL_C6/TMUsbDll加载失败: " << TCL_C6.errorString();
        return LOAD_FAIL;
    }
    return FEQUEST_FAIL;
}
int CallingDLL::TCLC6TMGMGetDeviceSN(int index,char* police_num,int* iRet)//获取电量值
{

    //将当前工作目录设置为应用程序所在的目录
      QLibrary TCL_C6(TCLC6);
    //QDir::setCurrent(QCoreApplication::applicationDirPath());
    typedef bool (*newCfun)(int index,char* police_num,int* iRet);
    newCfun funtest; //用于存放DLL函数的指针
    if (TCL_C6.load()) {
        qDebug() << "/TCL_C6/TMUsbDll加载成功";
        funtest = (newCfun)TCL_C6.resolve("TM_GM_GetDeviceSN");
        if (funtest) {
            qDebug() << "/TCL_C6/TM_GM_GetDeviceSN解析成功";
            //解析成功后，就可以使用funtest()来调用Cfun函数了：
            return  funtest(index,police_num,iRet);
        }
        else
        {
            qDebug() << "/TCL_C6/TM_GM_GetDeviceSN解析失败";
            return FUNCTION_CALL_FAIL;
        }
    } else {
        qDebug() << "/TCL_C6/TMUsbDll加载失败: " << TCL_C6.errorString();
        return LOAD_FAIL;
    }
    return FEQUEST_FAIL;
}

int CallingDLL::TCLC6TMEntryUMSByIndex(int index)//执法仪转盘
{

    //将当前工作目录设置为应用程序所在的目录
      QLibrary TCL_C6(TCLC6);
  //  QDir::setCurrent(QCoreApplication::applicationDirPath());
    typedef bool (*newCfun)(int index);
    newCfun funtest; //用于存放DLL函数的指针
    if (TCL_C6.load()) {
        qDebug() << "/TCL_C6/TMUsbDll加载成功";
        funtest = (newCfun)TCL_C6.resolve("TM_Entry_UMS_By_Index");
        if (funtest) {
            qDebug() << "/TCL_C6/TM_Entry_UMS_By_Index解析成功";
            //解析成功后，就可以使用funtest()来调用Cfun函数了：
            return funtest(index);
        }
        else
        {
            qDebug() << "/TCL_C6/TM_Entry_UMS_By_Index解析失败";
            return FUNCTION_CALL_FAIL;
        }
    } else {
        qDebug() << "/TCL_C6/TMUsbDll加载失败: " << TCL_C6.errorString();
        return LOAD_FAIL;
    }
    return FEQUEST_FAIL;
}
int CallingDLL::TCLC6TMdisconnectByIndex(int index)//断开设备 或者 拔出USB时调用
{

    //将当前工作目录设置为应用程序所在的目录
      QLibrary TCL_C6(TCLC6);
   // QDir::setCurrent(QCoreApplication::applicationDirPath());
    typedef int (*newCfun)(int index);
    newCfun funtest; //用于存放DLL函数的指针
    if (TCL_C6.load()) {
        qDebug() << "/TCL_C6/TMUsbDll加载成功";
        funtest = (newCfun)TCL_C6.resolve("TM_disconnect_By_Index");
        if (funtest) {
            qDebug() << "/TCL_C6/TM_disconnect_By_Index解析成功";
            //解析成功后，就可以使用funtest()来调用Cfun函数了：
            return funtest(index);
        }
        else
        {
            qDebug() << "/TCL_C6/TM_disconnect_By_Index解析失败";
            return FUNCTION_CALL_FAIL;
        }
    } else {
        qDebug() << "/TCL_C6/TMUsbDll加载失败: " << TCL_C6.errorString();
        return LOAD_FAIL;
    }
    return FEQUEST_FAIL;
}


bool CallingDLL::ZJXS2ZFY_Connect(int index,char* const device_name)
{
    QDir::setCurrent(QCoreApplication::applicationDirPath());
    typedef bool (*newCfun)(int index,char* const device_name);
    newCfun funtest;
        if (ZJX_S2->load()) {
        qDebug() << "./ZJX_S2/Mcs8CommonInf.so加载成功";
        funtest = (newCfun)ZJX_S2->resolve("ZFY_Connect");
        if (funtest) {
            qDebug() << "CZFY_Connect解析成功";
            int result = funtest(index,device_name);
            return result;
        } else {
            qDebug() << ".ZFY_Connect解析失败";
            return FUNCTION_CALL_FAIL;

    }
        }else {
        qDebug() << "./ZJX_S2/Mcs8CommonInf.so加载失败: " << ZJX_S2->errorString();
        return LOAD_FAIL;
    }
   return FEQUEST_FAIL;
}
bool  CallingDLL::ZJXS2Init_Device(char *IDCode,unsigned short int *iRet)          //连接设备
{
    QDir::setCurrent(QCoreApplication::applicationDirPath());
    typedef bool (*newCfun)(char *IDCode,unsigned short int *iRet);
    newCfun funtest;
    if (ZJX_S2->load()) {
        qDebug() << "./ZJX_S2/Mcs8CommonInf.dll加载成功";
        funtest = (newCfun)ZJX_S2->resolve("Init_Device");
        if (funtest) {
            qDebug() << "Init_Device解析成功";
            int result = funtest(IDCode,iRet);
            return result;
        } else {
            qDebug() << ".Init_Device解析失败";
            return FUNCTION_CALL_FAIL;
        }
    } else {
        qDebug() << "./ZJX_S2/Mcs8CommonInf.dll加载失败: " << ZJX_S2->errorString();
        return LOAD_FAIL;
    }
    return FEQUEST_FAIL;
}
bool  CallingDLL::ZJXS2GetIDCode(char * IDCode, unsigned short int * iRet)
{
    QDir::setCurrent(QCoreApplication::applicationDirPath());
    typedef bool (*newCfun)(char * IDCode, unsigned short int * iRet);
    newCfun funtest;
    if (ZJX_S2->load()) {
        qDebug() << "./ZJX_S2/Mcs8CommonInf.so加载成功";
        funtest = (newCfun)ZJX_S2->resolve("GetIDCode");
        if (funtest) {
            qDebug() << "GetIDCode解析成功";


            bool result = funtest(IDCode,iRet);

            return result;
        } else {
            qDebug() << "GetIDCode解析失败";
            return FUNCTION_CALL_FAIL;
        }
    } else {
        qDebug() << "/ZJX_S2/Mcs8CommonInf.so加载失败: " << ZJX_S2->errorString();
        return LOAD_FAIL;
    }
    return FEQUEST_FAIL;
}
bool  CallingDLL::ZJXS2SetMSDC(char *sPwd,unsigned short int *iRet)
{
    QDir::setCurrent(QCoreApplication::applicationDirPath());
    typedef bool (*newCfun)(char *sPwd,unsigned short int *iRet);
    newCfun funtest;
    if (ZJX_S2->load()) {
        qDebug() << "./ZJX_S2/Mcs8CommonInf.dll加载成功";
        funtest = (newCfun)ZJX_S2->resolve("SetMSDC");
        if (funtest) {
            qDebug() << "SetMSDC解析成功";


            bool result = funtest(sPwd,iRet);

            return result;
        } else {
            qDebug() << "SetMSDC解析失败";
            return FUNCTION_CALL_FAIL;
        }
    } else {
        qDebug() << "/HIKX1A1/Mcs8CommonInf.dll加载失败: " <<ZJX_S2->errorString();
        return LOAD_FAIL;
    }
    return FEQUEST_FAIL;
}
bool CallingDLL::ZJXS2SyncDevTime(char *sPwd,unsigned short int *iRet)
{
    QDir::setCurrent(QCoreApplication::applicationDirPath());
    typedef bool (*newCfun)(char *sPwd,unsigned short int *iRet);
    newCfun funtest;
    if (ZJX_S2->load()) {
        qDebug() << "./ZJX_S2/Mcs8CommonInf.dll加载成功";
        funtest = (newCfun)ZJX_S2->resolve("SyncDevTime");
        if (funtest) {
            qDebug() << "SyncDevTime解析成功";


            bool result = funtest(sPwd,iRet);

            return result;
        } else {
            qDebug() << "SyncDevTime解析失败";
            return FUNCTION_CALL_FAIL;
        }
    } else {
        qDebug() << "/HIKX1A1/Mcs8CommonInf.dll加载失败: " <<ZJX_S2->errorString();
        return LOAD_FAIL;
    }
    return FEQUEST_FAIL;
}
bool CallingDLL::ZJXS2ReadDeviceResolution(int *Battery,char *sPwd,unsigned short int *iRet)
{
    QDir::setCurrent(QCoreApplication::applicationDirPath());
    typedef bool (*newCfun)(int *Battery,char *sPwd,unsigned short int *iRet);
    newCfun funtest;
    if (ZJX_S2->load()) {
        qDebug() << "./ZJX_S2/Mcs8CommonInf.dll加载成功";
        funtest = (newCfun)ZJX_S2->resolve("ReadDeviceBatteryDumpEnergy");
        if (funtest) {
            qDebug() << "ReadDeviceBatteryDumpEnergy解析成功";


            bool result = funtest(Battery,sPwd,iRet);

            return result;
        } else {
            qDebug() << "ReadDeviceBatteryDumpEnergy解析失败";
            return FUNCTION_CALL_FAIL;
        }
    } else {
        qDebug() << "/HIKX1A1/Mcs8CommonInf.dll加载失败: " <<ZJX_S2->errorString();
        return LOAD_FAIL;
    }
    return FEQUEST_FAIL;
}
int CallingDLL::ZJXS2Release_Device()//
{

    //将当前工作目录设置为应用程序所在的目录
    QDir::setCurrent(QCoreApplication::applicationDirPath());
    typedef bool (*newCfun)();
    newCfun funtest; //用于存放DLL函数的指针
    if (ZJX_S2->load()) {
        qDebug() << "/ZJX_S2/TMUsbDll加载成功";
        funtest = (newCfun)ZJX_S2->resolve("Release_Device");
        if (funtest) {
            qDebug() << "/ZJX_S2/Release_Device解析成功";
            //解析成功后，就可以使用funtest()来调用Cfun函数了：
            return  funtest();
        }
        else
        {
            qDebug() << "/ZJX_S2/Release_Device解析失败";
            return FUNCTION_CALL_FAIL;
        }
    } else {
        qDebug() << "/ZJX_S2/Mcs8CommonInf.dll加载失败: " << ZJX_S2->errorString();
        return LOAD_FAIL;
    }
    return FEQUEST_FAIL;
}
//bool CallingDll::TCLS8GetDeviceID(char* const device_name,int* index)//断开设备 或者 拔出USB时调用
//{

//    //将当前工作目录设置为应用程序所在的目录
//    QDir::setCurrent(QCoreApplication::applicationDirPath());
//    typedef int (*newCfun)(char* const device_name,int* index);
//    newCfun funtest; //用于存放DLL函数的指针
//    if (TCL_S8->load()) {
//        qDebug() << "/TCL_S8/TMUsbDll加载成功";
//        funtest = (newCfun)TCL_S8->resolve("GetDeviceID");
//        if (funtest) {
//            qDebug() << "/TCL_S8/TM_disconnect_By_Index解析成功";
//            //解析成功后，就可以使用funtest()来调用Cfun函数了：
//            return funtest(device_name,index);
//        }
//        else
//        {
//            qDebug() << "/TCL_S8/TM_disconnect_By_Index解析失败";
//            return FUNCTION_CALL_FAIL;
//        }
//    } else {
//        qDebug() << "/TCL_S8/TMUsbDll加载失败: " << TCL_S8->errorString();
//        return LOAD_FAIL;
//    }
//    return FAIL;
//}
//bool CallingDll::TCLS8ReadDeviceBattery(int* index,int* index1)//断开设备 或者 拔出USB时调用
//{

//    //将当前工作目录设置为应用程序所在的目录
//    QDir::setCurrent(QCoreApplication::applicationDirPath());
//    typedef int (*newCfun)(int* index,int* index1);
//    newCfun funtest; //用于存放DLL函数的指针
//    if (TCL_S8->load()) {
//        qDebug() << "/TCL_S8/TMUsbDll加载成功";
//        funtest = (newCfun)TCL_S8->resolve("ReadDeviceBattery");
//        if (funtest) {
//            qDebug() << "/TCL_S8/TM_disconnect_By_Index解析成功";
//            //解析成功后，就可以使用funtest()来调用Cfun函数了：
//            return funtest(index,index1);
//        }
//        else
//        {
//            qDebug() << "/TCL_S8/TM_disconnect_By_Index解析失败";
//            return FUNCTION_CALL_FAIL;
//        }
//    } else {
//        qDebug() << "/TCL_S8/TMUsbDll加载失败: " << TCL_S8->errorString();
//        return LOAD_FAIL;
//    }
//    return FAIL;
//}
//int CallingDLL:: Decode111(std::string inFileName,std::string key,std::string iv)//断开设备 或者 拔出USB时调用
//{

//    //将当前工作目录设置为应用程序所在的目录
//    QDir::setCurrent(QCoreApplication::applicationDirPath());
//    QString filename = "LicenseLibrary.dll";
//    QFile file(filename);
//    if (file.exists())
//    {
//        // 转换为 std::wstring
//        std::wstring inFileNameWString(inFileName.begin(), inFileName.end());
//        // 转换为 std::wstring
//        std::wstring keyWString(key.begin(), key.end());
//        // 转换为 std::wstring
//        std::wstring ivWString(iv.begin(), iv.end());
//        // 获取const wchar_t*指针
//        const wchar_t* inFileNamewcharPtr = inFileNameWString.c_str();
//        // 获取const wchar_t*指针
//        const wchar_t* keywcharPtr = keyWString.c_str();
//        // 获取const wchar_t*指针
//        const wchar_t* ivwcharPtr = ivWString.c_str();
//        string str="";
//        typedef int (*newCfun)(const wchar_t*inFileNamewcharPtr,const wchar_t*keywcharPtr,const wchar_t*ivwcharPtr);
//        newCfun funtest; //用于存放DLL函数的指针
//        if (License->load()) {
//            qDebug() << "/License/Decode";
//            funtest = (newCfun)License->resolve("C_Decode_String");
//            if (funtest) {
//                qDebug() << "C_Decode_String解析成功";
//                return funtest(inFileNamewcharPtr,keywcharPtr,ivwcharPtr);
//                //解析成功后，就可以使用funtest()来调用Cfun函数了：
//            }
//            else
//            {
//                qDebug() << "C_Decode_String解析失败";
//                return FUNCTION_CALL_FAIL;
//            }
//        } else {
//            qDebug() << "C_Decode_String加载失败: " << License->errorString();
//            return LOAD_FAIL;
//        }
//        return FEQUEST_FAIL;
//    }
//    else
//    {
//        return FEQUEST_FAIL;
//    }

//}
//bool CallingDLL::TCLT6InitDevice(char* const device_name,int* index)
//{

//    QDir::setCurrent(QCoreApplication::applicationDirPath());
//    typedef int (*newCfun)(char* const device_name,int* index);
//    newCfun funtest;
//    if (TCL_T6->load()) {
//        qDebug() << "TMUsbDll加载成功";
//        funtest = (newCfun)TCL_T6->resolve("Init_Device");
//        if (funtest) {
//            qDebug() << "/TCL_T6/Init_Device解析成功";


//            bool result = funtest(device_name,index);

//            return result;
//        } else {
//            qDebug() << "/TCL_T6/Init_Device解析失败";
//            return FUNCTION_CALL_FAIL;
//        }
//    } else {
//        qDebug() << "/TCL_T6/Init_Device加载失败: " << TCL_T6->errorString();
//        return LOAD_FAIL;
//    }
//    return FEQUEST_FAIL;
//}
//bool CallingDLL::TCLT6GetDeviceID(char* const device_name,int* index)
//{

//    QDir::setCurrent(QCoreApplication::applicationDirPath());
//    typedef bool (*newCfun)(char* const device_name,int* index);
//    newCfun funtest;
//    if (TCL_T6->load()) {
//        qDebug() << "TMUsbDll加载成功";
//        funtest = (newCfun)TCL_T6->resolve("GetDeviceID");
//        if (funtest) {
//            qDebug() << "/TCL_T6/GetDeviceID解析成功";


//            bool result = funtest(device_name,index);

//            return result;
//        } else {
//            qDebug() << "/TCL_T6/GetDeviceID解析失败";
//            return FUNCTION_CALL_FAIL;
//        }
//    } else {
//        qDebug() << "/TCL_T6/GetDeviceID加载失败: " << TCL_T6->errorString();
//        return LOAD_FAIL;
//    }
//    return FEQUEST_FAIL;
//}
//int CallingDLL::TCLT6findNewDVSlot(int* index)
//{

//    QDir::setCurrent(QCoreApplication::applicationDirPath());
//    typedef int (*newCfun)(int* index);
//    newCfun funtest;
//    if (TCL_T6->load()) {
//        qDebug() << "TMUsbDll加载成功";
//        funtest = (newCfun)TCL_T6->resolve("findNewDVSlot");
//        if (funtest) {
//            qDebug() << "/TCL_T6/findNewDVSlot解析成功";


//            int result = funtest(index);

//            return result;
//        } else {
//            qDebug() << "/TCL_T6/findNewDVSlot解析失败";
//            return FUNCTION_CALL_FAIL;
//        }
//    } else {
//        qDebug() << "/TCL_T6/findNewDVSlot加载失败: " << TCL_T6->errorString();
//        return LOAD_FAIL;
//    }
//    return FEQUEST_FAIL;
//}
//bool CallingDLL::TCLT6SyncDevTime(char* pwd,int* iRet)
//{
//    QDir::setCurrent(QCoreApplication::applicationDirPath());
//    typedef bool (*newCfun)(char* pwd,int* iRet);
//    newCfun funtest;
//    if (TCL_T6->load()) {
//        qDebug() << "TMUsbDll加载成功";
//        funtest = (newCfun)TCL_T6->resolve("SyncDevTime");
//        if (funtest) {
//            qDebug() << "/TCL_T6/TCLT6SyncDevTime解析成功";


//            bool result = funtest(pwd,iRet);

//            return result;
//        } else {
//            qDebug() << "/TCL_T6/SyncDevTime解析失败";
//            return FUNCTION_CALL_FAIL;
//        }
//    } else {
//        qDebug() << "/TCL_T6/ReadDeviceBattery加载失败: " << TCL_T6->errorString();
//        return LOAD_FAIL;
//    }
//    return FEQUEST_FAIL;
//}
//bool CallingDLL::TCLT6ReadDeviceBattery(int* index,int* iRet)
//{
//    QDir::setCurrent(QCoreApplication::applicationDirPath());
//    typedef bool (*newCfun)(int* index,int* iRet);
//    newCfun funtest;
//    if (TCL_T6->load()) {
//        qDebug() << "TMUsbDll加载成功";
//        funtest = (newCfun)TCL_T6->resolve("ReadDeviceBattery");
//        if (funtest) {
//            qDebug() << "/TCL_T6/TCLT6ReadDeviceBattery解析成功";


//            bool result = funtest(index,iRet);

//            return result;
//        } else {
//            qDebug() << "/TCL_T6/ReadDeviceBattery解析失败";
//            return FUNCTION_CALL_FAIL;
//        }
//    } else {
//        qDebug() << "/TCL_T6/ReadDeviceBattery加载失败: " << TCL_T6->errorString();
//        return LOAD_FAIL;
//    }
//    return FEQUEST_FAIL;
//}
//bool CallingDLL::TCLT6GetZFYInfo(ZFY_INFO_S8 *index,char* pwd,int* iRet)
//{
//    QDir::setCurrent(QCoreApplication::applicationDirPath());
//    typedef bool (*newCfun)(ZFY_INFO_S8 *index,char* pwd,int* iRet);
//    newCfun funtest;
//    if (TCL_T6->load()) {
//        qDebug() << "TMUsbDll加载成功";
//        funtest = (newCfun)TCL_T6->resolve("GetZFYInfo");
//        if (funtest) {
//            qDebug() << "/TCL_T6/GetZFYInfo解析成功";


//            bool result = funtest(index,pwd,iRet);

//            return result;
//        } else {
//            qDebug() << "/TCL_T6/GetZFYInfo解析失败";
//            return FUNCTION_CALL_FAIL;
//        }
//    } else {
//        qDebug() << "/TCL_T6/GetZFYInfo加载失败: " << TCL_T6->errorString();
//        return LOAD_FAIL;
//    }
//    return FEQUEST_FAIL;
//}
////bool CallingDll::TCLT6GetZFYInfo(ZFY_INFO_S8 *index,std::string pwd,int* iRet)
////{
////    QDir::setCurrent(QCoreApplication::applicationDirPath());
////    typedef bool (*newCfun)(ZFY_INFO_S8 *index,std::string pwd,int* iRet);
////    newCfun funtest;
////    if (TCL_T6->load()) {
////        qDebug() << "TMUsbDll加载成功";
////        funtest = (newCfun)TCL_T6->resolve("GetZFYInfo");
////        if (funtest) {
////            qDebug() << "/TCL_T6/GetZFYInfo解析成功";


////            bool result = funtest(index,pwd,iRet);

////            return result;
////        } else {
////            qDebug() << "/TCL_T6/GetZFYInfo解析失败";
////            return FUNCTION_CALL_FAIL;
////        }
////    } else {
////        qDebug() << "/TCL_T6/GetZFYInfo加载失败: " << TCL_T6->errorString();
////        return LOAD_FAIL;
////    }
////    return FAIL;
////}
//bool CallingDLL::TCLT6SetMSDC(char* index,int* iRet)
//{
//    QDir::setCurrent(QCoreApplication::applicationDirPath());
//    typedef bool (*newCfun)(char* index,int* iRet);
//    newCfun funtest;
//    if (TCL_T6->load()) {
//        qDebug() << "TMUsbDll加载成功";
//        funtest = (newCfun)TCL_T6->resolve("SetMSDC");
//        if (funtest) {
//            qDebug() << "/TCL_T6/SetMSDC解析成功";


//            bool result = funtest(index,iRet);

//            return result;
//        } else {
//            qDebug() << "/TCL_T6/SetMSDC解析失败";
//            return FUNCTION_CALL_FAIL;
//        }
//    } else {
//        qDebug() << "/TCL_T6SetMSDC加载失败: " << TCL_T6->errorString();
//        return LOAD_FAIL;
//    }
//    return FEQUEST_FAIL;
//}

////bool CallingDll::TCLT6SetMSDC(std::string index,int* iRet)
////{
////    QDir::setCurrent(QCoreApplication::applicationDirPath());
////    typedef bool (*newCfun)(std::string index,int* iRet);
////    newCfun funtest;
////    if (TCL_T6->load()) {
////        qDebug() << "TMUsbDll加载成功";
////        funtest = (newCfun)TCL_T6->resolve("SetMSDC");
////        if (funtest) {
////            qDebug() << "/TCL_T6/SetMSDC解析成功";


////            bool result = funtest(index,iRet);

////            return result;
////        } else {
////            qDebug() << "/TCL_T6/SetMSDC解析失败";
////            return FUNCTION_CALL_FAIL;
////        }
////    } else {
////        qDebug() << "/TCL_T6SetMSDC加载失败: " << TCL_T6->errorString();
////        return LOAD_FAIL;
////    }
////    return FAIL;
////}

//bool CallingDLL::TCLR1GetIDCode(char *cID, unsigned short *usRet)
//{
//    QDir::setCurrent(QCoreApplication::applicationDirPath());
//    typedef bool (*newCfun)(char *cID, unsigned short *usRet);
//    newCfun funtest;
//    if (TCL_R1->load()) {
//        qDebug() << "TMUsbDll加载成功";
//        funtest = (newCfun)TCL_R1->resolve("GetIDCode");
//        if (funtest) {
//            qDebug() << "/TCL_R1/GetIDCode解析成功";


//            bool result = funtest(cID,usRet);

//            return result;
//        } else {
//            qDebug() << "/TCL_R1/GetIDCode解析失败";
//            return FUNCTION_CALL_FAIL;
//        }
//    } else {
//        qDebug() << "/TCL_R1/GetIDCode加载失败: " << TCL_R1->errorString();
//        return LOAD_FAIL;
//    }
//    return FEQUEST_FAIL;
//}

//bool CallingDLL::TCLR1Init_Device(char *cID, unsigned short *usRet)
//{
//    QDir::setCurrent(QCoreApplication::applicationDirPath());
//    typedef bool (*newCfun)(char *cID, unsigned short *usRet);
//    newCfun funtest;
//    if (TCL_R1->load()) {
//        qDebug() << "TMUsbDll加载成功";
//        funtest = (newCfun)TCL_R1->resolve("Init_Device");
//        if (funtest) {
//            qDebug() << "/TCL_R1/Init_Device解析成功";


//            bool result = funtest(cID,usRet);

//            return result;
//        } else {
//            qDebug() << "/TCL_R1/Init_Device解析失败";
//            return FUNCTION_CALL_FAIL;
//        }
//    } else {
//        qDebug() << "/TCL_R1/Init_Device加载失败: " << TCL_R1->errorString();
//        return LOAD_FAIL;
//    }
//    return FEQUEST_FAIL;
//}

//bool CallingDLL::TCLR1GetZFYInfo(ZFY_INFO *sZfyInfo, char *cPassword, unsigned short *usRet)
//{
//    QDir::setCurrent(QCoreApplication::applicationDirPath());
//    typedef bool (*newCfun)(ZFY_INFO *sZfyInfo, char *cPassword, unsigned short *usRet);
//    newCfun funtest;
//    if (TCL_R1->load()) {
//        qDebug() << "TMUsbDll加载成功";
//        funtest = (newCfun)TCL_R1->resolve("GetZFYInfo");
//        if (funtest) {
//            qDebug() << "/TCL_R1/GetZFYInfo解析成功";


//            bool result = funtest(sZfyInfo,cPassword,usRet);

//            return result;
//        } else {
//            qDebug() << "/TCL_R1/GetZFYInfo解析失败";
//            return FUNCTION_CALL_FAIL;
//        }
//    } else {
//        qDebug() << "/TCL_R1/GetZFYInfo加载失败: " << TCL_R1->errorString();
//        return LOAD_FAIL;
//    }
//    return FEQUEST_FAIL;
//}

//bool CallingDLL::TCLR1SyncDevTime(char *cPassword, unsigned short *usRet)
//{
//    QDir::setCurrent(QCoreApplication::applicationDirPath());
//    typedef bool (*newCfun)(char *cPassword, unsigned short *usRet);
//    newCfun funtest;
//    if (TCL_R1->load()) {
//        qDebug() << "TMUsbDll加载成功";
//        funtest = (newCfun)TCL_R1->resolve("SyncDevTime");
//        if (funtest) {
//            qDebug() << "/TCL_R1/SyncDevTime解析成功";


//            bool result = funtest(cPassword,usRet);

//            return result;
//        } else {
//            qDebug() << "/TCL_R1/SyncDevTime解析失败";
//            return FUNCTION_CALL_FAIL;
//        }
//    } else {
//        qDebug() << "/TCL_R1/SyncDevTime加载失败: " << TCL_R1->errorString();
//        return LOAD_FAIL;
//    }
//    return FEQUEST_FAIL;
//}

//bool CallingDLL::TCLR1ReadDeviceBatteryDumpEnergy(int *Battery, char *cPassword, unsigned short *usRet)
//{
//    QDir::setCurrent(QCoreApplication::applicationDirPath());
//    typedef bool (*newCfun)(int *Battery, char *cPassword, unsigned short *usRet);
//    newCfun funtest;
//    if (TCL_R1->load()) {
//        qDebug() << "TMUsbDll加载成功";
//        funtest = (newCfun)TCL_R1->resolve("ReadDeviceBatteryDumpEnergy");
//        if (funtest) {
//            qDebug() << "/TCL_R1/ReadDeviceBatteryDumpEnergy解析成功";


//            bool result = funtest(Battery,cPassword,usRet);

//            return result;
//        } else {
//            qDebug() << "/TCL_R1/ReadDeviceBatteryDumpEnergy解析失败";
//            return FUNCTION_CALL_FAIL;
//        }
//    } else {
//        qDebug() << "/TCL_R1/ReadDeviceBatteryDumpEnergy加载失败: " << TCL_R1->errorString();
//        return LOAD_FAIL;
//    }
//    return FEQUEST_FAIL;
//}

//bool CallingDLL::TCLR1SetMSDC(char *cPassword, unsigned short *usRet)
//{
//    QDir::setCurrent(QCoreApplication::applicationDirPath());
//    typedef bool (*newCfun)(char *cPassword, unsigned short *usRet);
//    newCfun funtest;
//    if (TCL_R1->load()) {
//        qDebug() << "TMUsbDll加载成功";
//        funtest = (newCfun)TCL_R1->resolve("SetMSDC");
//        if (funtest) {
//            qDebug() << "/TCL_R1/SetMSDC解析成功";


//            bool result = funtest(cPassword,usRet);

//            return result;
//        } else {
//            qDebug() << "/TCL_R1/SetMSDC解析失败";
//            return FUNCTION_CALL_FAIL;
//        }
//    } else {
//        qDebug() << "/TCL_R1/SetMSDC加载失败: " << TCL_R1->errorString();
//        return LOAD_FAIL;
//    }
//    return FEQUEST_FAIL;
//}
//int CallingDLL::TCL3AfindNewDVSlot(ushort slot)
//{
//    QDir::setCurrent(QCoreApplication::applicationDirPath());
//    typedef int (*newCfun)(ushort slot);
//    newCfun funtest;
//    if (TCL_3A->load()) {
//        qDebug() << "findNewDVSlot加载成功";
//        funtest = (newCfun)TCL_3A->resolve("findNewDVSlot");
//        if (funtest) {
//            qDebug() << "/TCL_3A/findNewDVSlot解析成功";
//            int result = funtest(slot);
//            return result;
//        } else {
//            qDebug() << "/TCL_3A/findNewDVSlot解析失败";
//            return FUNCTION_CALL_FAIL;
//        }
//    } else {
//        qDebug() << "/TCL_3A/findNewDVSlot加载失败: " << TCL_3A->errorString();
//        return LOAD_FAIL;
//    }
//    return FEQUEST_FAIL;
//}
//bool CallingDLL::TCL3AGetDeviceID(ushort slot,char *DVSN, int DVSNSize)
//{
//    QDir::setCurrent(QCoreApplication::applicationDirPath());
//    typedef bool (*newCfun)(ushort slot,char *DVSN, int DVSNSize);
//    newCfun funtest;
//    if (TCL_3A->load()) {
//        qDebug() << "GetDeviceID加载成功";
//        funtest = (newCfun)TCL_3A->resolve("GetDeviceID");
//        if (funtest) {
//            qDebug() << "/TCL_3A/GetDeviceID解析成功";
//            bool result = funtest(slot,DVSN,DVSNSize);
//            return result;
//        } else {
//            qDebug() << "/TCL_3A/GetDeviceID解析失败";
//            return FUNCTION_CALL_FAIL;
//        }
//    } else {
//        qDebug() << "/TCL_3A/GetDeviceID加载失败: " << TCL_3A->errorString();
//        return LOAD_FAIL;
//    }
//    return FEQUEST_FAIL;
//}
//bool CallingDLL::TCL3AchkDVPwd(ushort slot,char *pwd)
//{
//    QDir::setCurrent(QCoreApplication::applicationDirPath());
//    typedef bool (*newCfun)(ushort slot,char *pwd);
//    newCfun funtest;
//    if (TCL_3A->load()) {
//        qDebug() << "TCL3AchkDVPwd加载成功";
//        funtest = (newCfun)TCL_3A->resolve("chkDVPwd");
//        if (funtest) {
//            qDebug() << "/TCL_3A/TCL3chkDVPwd解析成功";
//            bool result = funtest(slot,pwd);
//            return result;
//        } else {
//            qDebug() << "/TCL_3A/TCL3chkDVPwd解析失败";
//            return FUNCTION_CALL_FAIL;
//        }
//    } else {
//        qDebug() << "/TCL_3A/TCL3chkDVPwd加载失败: " << TCL_3A->errorString();
//        return LOAD_FAIL;
//    }
//    return FEQUEST_FAIL;
//}
//bool CallingDLL::TCL3ASetMSDC(ushort slot)
//{
//    QDir::setCurrent(QCoreApplication::applicationDirPath());
//    typedef bool (*newCfun)(ushort slot);
//    newCfun funtest;
//    if (TCL_3A->load()) {
//        qDebug() << "GetDeviceID加载成功";
//        funtest = (newCfun)TCL_3A->resolve("SetMSDC");
//        if (funtest) {
//            qDebug() << "/TCL_3A/SetMSDC解析成功";
//            bool result = funtest(slot);
//            return result;
//        } else {
//            qDebug() << "/TCL_3A/SetMSDC解析失败";
//            return FUNCTION_CALL_FAIL;
//        }
//    } else {
//        qDebug() << "/TCL_3A/SetMSDC加载失败: " << TCL_3A->errorString();
//        return LOAD_FAIL;
//    }
//    return FEQUEST_FAIL;
//}

//bool CallingDLL::TCLC7Init_Device2(char *IDCode,char *SN, unsigned short *usRet)
//{
//    QDir::setCurrent(QCoreApplication::applicationDirPath());
//    typedef bool (*newCfun)(char *IDCode,char *SN, unsigned short *usRet);
//    newCfun funtest;
//    if (TCL_C7->load()) {
//        qDebug() << "Init_Device2加载成功";
//        funtest = (newCfun)TCL_C7->resolve("Init_Device2");
//        if (funtest) {
//            qDebug() << "/TCL_C7/Init_Device2解析成功";
//            bool result = funtest(IDCode,SN,usRet);
//            return result;
//        } else {
//            qDebug() << "/TCL_C7/Init_Device2解析失败";
//            return FUNCTION_CALL_FAIL;
//        }
//    } else {
//        qDebug() << "/TCL_C7/Init_Device2加载失败: " << TCL_C7->errorString();
//        return LOAD_FAIL;
//    }
//    return FEQUEST_FAIL;
//}
//bool CallingDLL::TCLC7GetIDCode2(char *IDCode,char *SN, unsigned short *usRet)
//{
//    QDir::setCurrent(QCoreApplication::applicationDirPath());
//    typedef bool (*newCfun)(char *IDCode,char *SN, unsigned short *usRet);
//    newCfun funtest;
//    if (TCL_C7->load()) {
//        qDebug() << "GetIDCode2加载成功";
//        funtest = (newCfun)TCL_C7->resolve("GetIDCode2");
//        if (funtest) {
//            qDebug() << "/TCL_C7/GetIDCode2解析成功";
//            bool result = funtest(IDCode,SN,usRet);
//            return result;
//        } else {
//            qDebug() << "/TCL_C7/GetIDCode2解析失败";
//            return FUNCTION_CALL_FAIL;
//        }
//    } else {
//        qDebug() << "/TCL_C7/GetIDCode2加载失败: " << TCL_C7->errorString();
//        return LOAD_FAIL;
//    }
//    return FEQUEST_FAIL;
//}
//bool CallingDLL::TCLC7ReadDeviceBatteryDumpEnergy2(int *IDCode,char *SN,char *pwd, unsigned short *usRet)
//{
//    QDir::setCurrent(QCoreApplication::applicationDirPath());
//    typedef bool (*newCfun)(int *IDCode,char *SN,char *pwd, unsigned short *usRet);
//    newCfun funtest;
//    if (TCL_C7->load()) {
//        qDebug() << "ReadDeviceBatteryDumpEnergy2加载成功";
//        funtest = (newCfun)TCL_C7->resolve("ReadDeviceBatteryDumpEnergy2");
//        if (funtest) {
//            qDebug() << "/TCL_C7/ReadDeviceBatteryDumpEnergy2解析成功";
//            bool result = funtest(IDCode,SN,pwd,usRet);
//            return result;
//        } else {
//            qDebug() << "/TCL_C7/ReadDeviceBatteryDumpEnergy2解析失败";
//            return FUNCTION_CALL_FAIL;
//        }
//    } else {
//        qDebug() << "/TCL_C7/ReadDeviceBatteryDumpEnergy2加载失败: " << TCL_C7->errorString();
//        return LOAD_FAIL;
//    }
//    return FEQUEST_FAIL;
//}

//bool CallingDLL::TCLC7SetMSDC2(char *SN, char *pwd, unsigned short *usRet)
//{
//    QDir::setCurrent(QCoreApplication::applicationDirPath());
//    typedef bool (*newCfun)(char *SN, char *pwd, unsigned short *usRet);
//    newCfun funtest;
//    if (TCL_C7->load()) {
//        qDebug() << "SetMSDC2加载成功";
//        funtest = (newCfun)TCL_C7->resolve("SetMSDC2");
//        if (funtest) {
//            qDebug() << "/TCL_C7/SetMSDC2解析成功";
//            bool result = funtest(SN,pwd,usRet);
//            return result;
//        } else {
//            qDebug() << "/TCL_C7/SetMSDC2解析失败";
//            return FUNCTION_CALL_FAIL;
//        }
//    } else {
//        qDebug() << "/TCL_C7/SetMSDC2加载失败: " << TCL_C7->errorString();
//        return LOAD_FAIL;
//    }
//    return FEQUEST_FAIL;
//}

//typedef  int (*Initfun)();
//int CallingDll::TMUsbInit() {
//   QLibrary mso("./tmsdk/tmusb.so");
//   int initResult=-5;
//   if(mso.load())
//   {
//        qDebug() << "jzcg";

//  Initfun initFunc =(Initfun)mso.resolve("TM_Usb_Init");
//  if(initFunc)
//  {
//      initResult=initFunc();
//  }
//     }


//   return initResult;
//}
